package com.sjy.shopmall.config;

import com.sjy.shopmall.vo.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
@Slf4j
public class ExceptionHandler {

    @org.springframework.web.bind.annotation.ExceptionHandler
    public ResultVO errorHandle(Throwable throwable) {
        log.error(throwable.getMessage(), throwable);//Slf4j的效果
        return new ResultVO(ResultVO.fail, throwable.getMessage(), throwable);
    }

}
